package com.hq.fxh.No5_User.User.Activity;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.hq.fxh.No0_ChengQu.Activity.BaseActivity;
import com.hq.fxh.No5_User.User.Adapter.Ladapter_FenSi;
import com.hq.fxh.No5_User.User.Adapter.Ladapter_YouHui;
import com.hq.fxh.R;
import com.hq.fxh.Utils.LogUtils;

public class QianBao extends BaseActivity implements View.OnClickListener {

    protected ImageView toolbarImageBack;
    protected LinearLayout toolbarLayoutBack;
    protected TextView toolBarTvTitle;
    protected TextView toolBarTvMore;
    protected LinearLayout toolbarLayoutMore;
    protected TextView tvQianBaoMoney;
    protected TextView tvQianBaoTiXian;
    protected TextView tvQianBaoChongZhi;
    protected PullToRefreshListView listYouHuiQuan;
    private View inflate;
    private Ladapter_YouHui adapter;


    @Override
    protected int getLayoutId() {
        return R.layout.activity_qian_bao;
    }

    @Override
    protected void initView() {
        inflate = LayoutInflater.from(this).inflate(R.layout.top_qianbao, null);

        toolbarImageBack = (ImageView) findViewById(R.id.toolbar_image_back);
        toolbarLayoutBack = (LinearLayout) findViewById(R.id.toolbar_Layout_back);
        toolbarLayoutBack.setOnClickListener(QianBao.this);
        toolBarTvTitle = (TextView) findViewById(R.id.toolBar_tv_Title);
        toolBarTvMore = (TextView) findViewById(R.id.toolBar_tv_More);
        toolBarTvMore.setOnClickListener(QianBao.this);
        toolbarLayoutMore = (LinearLayout) findViewById(R.id.toolbar_Layout_More);
        tvQianBaoMoney = (TextView) inflate.findViewById(R.id.tv_QianBao_Money);
        tvQianBaoTiXian = (TextView) inflate.findViewById(R.id.tv_QianBao_TiXian);
        tvQianBaoChongZhi = (TextView) inflate.findViewById(R.id.tv_QianBao_ChongZhi);
        listYouHuiQuan = (PullToRefreshListView) findViewById(R.id.list_YouHuiQuan);
    }

    @Override
    protected void initData() {
        initListener();

        listYouHuiQuan.getRefreshableView().addHeaderView(inflate);
        adapter = new Ladapter_YouHui();
        listYouHuiQuan.setAdapter(adapter);


    }

    private void initListener() {
        tvQianBaoChongZhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                LogUtils.e("充值功能马上开启");
            }
        });
        tvQianBaoTiXian.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                LogUtils.e("提现功能马上开启");
            }
        });
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.toolbar_Layout_back) {
            finish();

        } else if (view.getId() == R.id.toolBar_tv_More) {
            LogUtils.e("明细功能马上开启");

        }
    }
}
